﻿@using Abp.Extensions
@using AbpZeroTemplate.Authorization.Roles
@using AbpZeroTemplate.Web.Areas.AppAreaName.Models.Common.Modals
@using AbpZeroTemplate.Web.Areas.AppAreaName.Models.Roles
@model CreateOrEditRoleModalViewModel

@Html.Partial("~/Areas/AppAreaName/Views/Common/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(Model.IsEditMode ? (L("EditRole") + ": " + Model.Role.DisplayName) : L("CreateNewRole")))

<div class="modal-body">

    <ul class="nav nav-tabs  m-tabs-line" role="tablist">
        <li class="nav-item m-tabs__item">
            <a href="#RoleInformationsTab" class="nav-link m-tabs__link active" data-toggle="tab" role="tab">
                @L("RoleProperties")
            </a>
        </li>
        <li class="nav-item m-tabs__item">
            <a href="#PermissionsTab" class="nav-link m-tabs__link" data-toggle="tab" role="tab">
                @L("Permissions")
            </a>
        </li>
    </ul>


    <div class="tab-content">
        <div class="tab-pane active" id="RoleInformationsTab" role="tabpanel">
            <form name="RoleInformationsForm" role="form" novalidate class="form-validation">

                @if (Model.IsEditMode)
                {
                    <input type="hidden" name="Id" value="@Model.Role.Id"/>
                }

                <div class="form-group">
                    <label for="RoleName">@L("RoleName")</label>
                    <input id="RoleName" class="form-control@(Model.Role.DisplayName.IsNullOrEmpty() ? "" : " edited")" type="text" name="DisplayName" value="@Model.Role.DisplayName" required maxlength="@Role.MaxDisplayNameLength">
                </div>
                
                <div class="m-checkbox-list">
                    <label class="m-checkbox">
                        <input id="EditRole_IsDefault" type="checkbox" name="IsDefault" value="true" @Html.Raw(Model.Role.IsDefault ? "checked=\"checked\"" : "")>
                        @L("Default")
                        <span></span>
                    </label>
                    <span class="help-block">@L("DefaultRole_Description")</span>
                </div>

            </form>
        </div>
        <div class="tab-pane" id="PermissionsTab" role="tabpanel">
            @Html.Partial("~/Areas/AppAreaName/Views/Common/_PermissionTree.cshtml", Model)
        </div>
    </div>


    <div class="alert alert-warning" style="margin-top: 30px;">
        <em>@L("Note_RefreshPageForPermissionChanges")</em>
    </div>
</div>

@Html.Partial("~/Areas/AppAreaName/Views/Common/Modals/_ModalFooterWithSaveAndCancel.cshtml")